package luj.groovy.excel.internal.table.create

import luj.groovy.excel.api.table.Table
import luj.groovy.excel.internal.table.body.TableBodyMaker
import luj.groovy.excel.internal.table.header.TableHeaderMaker

class TableInSheetMaker {

  TableInSheetMaker(BuildTableImpl tableBuilder) {
    _tableBuilder = tableBuilder
  }

  Table make() {
    def headerR = new TableHeaderMaker(_tableBuilder._header).make()

    def table = new TableImpl()
    table._header = headerR.header()
    table._body = new TableBodyMaker(_tableBuilder._sheet, headerR).make()

    return table
  }

  private final BuildTableImpl _tableBuilder
}
